from django.db import models

# Create your models here.


class Pizza(models.Model):
    """Which holds names of pizza"""
    name = models.CharField(max_length=30)
    date_added = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        """Return string to represent of the model"""
        return self.name


class Topping(models.Model):
    """Which holds names of toppings and connect with Pizza"""
    pizza = models.ForeignKey(Pizza, on_delete=models.CASCADE)
    name = models.CharField(max_length=30)
    date_added = models.DateTimeField(auto_now_add=True)

    class Meta:
        """Change the name of model in website display"""
        # verbose_name = "试试中文"
        verbose_name_plural = 'Toppings'

    def __str__(self):
        """Return string to represent of the model"""
        return self.name
